home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-17 / prbgi095.zip / PASCAL.ZIP / PRTGRAPH.INT < prev    next >
Text File  |  1992-06-17  |  8KB  |  199 lines

  1. {
  2.    Printer BGI driver C interface
  3.    Copyright (c) 1991 A. Resztak
  4.  }
  5.  
  6. unit PRTGraph;
  7.  
  8. Interface
  9.  
  10.  (*   Header file *)
  11.  
  12.  const   PRT_NO_MEMORY           = 1;
  13.  const   PRT_WRONG_PARAMETERS = 2;
  14.  const   PRT_NOT_INITIALIZED     = 3;
  15.  const   PRT_IO_ERROR            = 4;
  16.  const   PRT_ERROR               = 5;
  17.  
  18. {$ifdef These_constants_are_defined_in_ PDrivers.pas file }
  19.  
  20.  (*   drivers  *)
  21.  
  22.  const Star_SR9   = 0;
  23.        IBM9       = 1;  (* IBM GraphPrinter,IBM ProPrinter  *)
  24.        EPSON9     = 1;     (* EPSON (graphic mode: Esc,'K'/'L'/'Y'/'Z') *)
  25.        EPSON9II   = 2;     (* EPSON (graphic mode: Esc,'*',n) *)
  26.        PANASONIC9 = 3;     (* Panasonic KX-P1124 - not tested *)
  27.        IBM9c      = 4;     (* IBM ProPrinter (color) *)
  28.        EPSON9c    = 4;     (* EPSON (color) (graphic mode: Esc,'K'/'L'/'Y'/'Z') *)
  29.        EPSON9IIc  = 5;     (* EPSON (color) (graphic mode: Esc,'*',n) *)
  30.        EPSON24    = 6;     (* 24 pins EPSON compatible printer *)
  31.        IBM24      = 7;     (* 24 pins IBM compatible printer *)
  32.        EPSON24c   = 8;     (* 24 pins EPSON compatible color printer *)
  33.                            (*  not tested *)
  34.        IBM24c     = 9;     (* 24 pins IBM compatible color printer *)
  35.                            (*  not tested *)
  36.        PaintJet   = 10;    (* Paint Jet  *)
  37.        HPPaintJet = 11;    (* HP Paint Jet *)
  38.        LaserJet   = 12;    (* Laser Jet *)
  39.        HPLJII     = 13;    (* HP Laser Jet *)
  40.  
  41.  (* modes for particular drivers *)
  42.  
  43.    (* EPSON9   *)
  44.       const  EPSON9_60x72     = 0;
  45.       const  EPSON9_120x72    = 1;
  46.       const  EPSON9_120x216   = 2;
  47.       const  EPSON9_240x216   = 3;
  48.    (* STAR_SR9    *)
  49.       const  STAR_SR9_60x72       = 0;
  50.       const  STAR_SR9_120x72      = 1;
  51.       const  STAR_SR9_120x144     = 2;
  52.       const  STAR_SR9_240x144     = 3;
  53.    (* IBM9     *)
  54.       const  IBM9_60x72       = 0;
  55.       const  IBM9_120x72      = 1;
  56.       const  IBM9_120x216     = 2;
  57.       const  IBM9_240x216     = 3;
  58.    (* EPSON24  *)
  59.       const  EPSON24_60x180    = 0;
  60.       const  EPSON24_120x180   = 1;
  61.       const  EPSON24_180x180   = 2;
  62.       const  EPSON24_360x180   = 3;
  63.       const  EPSON24_360x360   = 4;
  64.    (* IBM24    *)
  65.       const  IBM24_60x180    = 0;
  66.       const  IBM24_120x180   = 1;
  67.       const  IBM24_180x180   = 2;
  68.       const  IBM24_360x180   = 3;
  69.    (* PaintJet   *)
  70.       const  PaintJet_90x90       = 0;
  71.       const  PaintJet_180x180     = 1;
  72.       const  PaintJet_90x90c      = 2;
  73.       const  PaintJet_180x180c    = 3;
  74.    (* HPPJ   *)
  75.       const  HPPJ_90x90       = 0;
  76.       const  HPPJ_180x180     = 1;
  77.       const  HPPJ_90x90c      = 2;
  78.       const  HPPJ_180x180c    = 3;
  79.    (* LaserJet   *)
  80.       const  LaserJet_75x75      =  0;
  81.       const  LaserJet_100x100    =  1;
  82.       const  LaserJet_150x150    =  2;
  83.       const  LaserJet_300x300    =  3;
  84.    (* HPLJII   *)
  85.       const  HPLJII_75x75      =  0;
  86.       const  HPLJII_100x100    =  1;
  87.       const  HPLJII_150x150    =  2;
  88.       const  HPLJII_300x300    =  3;
  89.  
  90. {$endif }
  91.  
  92.  (*   P R O C E D U R E S    P R O T O T Y P E S   *)
  93.  
  94. Type
  95.     stringPtr = ^string;
  96.  
  97. (* Procedures which may be called before initializing PBGI *)
  98. Function PRT_SetDriver ( drv, mode, width, height, options: word ): integer;
  99. Const
  100.    PRT_NORMAL  = 0;
  101.    PRT_ROTATE  = 1;
  102.    PRT_INVERSE = 2;
  103.    PRT_REVERSE = 2;
  104.  
  105. Function PRT_Buffer ( address: Pointer; size: longint; usable: integer ) : integer;
  106. Function PRT_EMSBuffer ( handle: integer; size: longint; usable: integer ) : integer;
  107. Function PRT_XMSBuffer ( handle: integer; size: longint; usable: integer ): integer;
  108. Function PRT_SetBuffer ( size: longint; BufOpt: word ) : integer;
  109.       Const  NotUseEMS  = 1;
  110.              NotUseXMS  = 2;
  111. { Function PRT_DefineWorld ( MaxX, MaxY: word ) : integer; }
  112. Function PRT_SetOutName ( DeviceName: string ) : integer;
  113. Function PRT_SetMargins ( left, top: integer ) : integer;
  114. Function PRT_RescaleFillPattern ( r: integer ) : integer;
  115.                         (* 0 = never, 1 = always , -1 = at high densities only *)
  116.  
  117.  (* Procedure allocates PRT buffer, initializes PBGI, calls Draw(),
  118.     closes PBGI, prints picture, and frees the buffer.
  119.     All above is done neccesary number of times to print
  120.     entire picture. *)
  121. Type DrawFuncT = function(UserPointer:pointer): integer;
  122. Function PRT_PrintBGI ( var graphdriver, graphmode: integer;
  123.                         pathtodriver: string;
  124.                         Draw: DrawFuncT; UserPointer: pointer ): integer;
  125.  
  126.  
  127.        (* Various informing procedures *)
  128.    (* May be allways called   *)
  129. Function PRT_MaxDriver: integer;
  130. Function PRT_DriverName ( driverno: word; var name_ptr: stringPtr ): integer;
  131. Function PRT_MaxMode ( driverno: word; var maxmode: integer ): integer;
  132. Function PRT_ModeName ( driverno: word; modeno: integer;
  133.                         var name_ptr: stringPtr ): integer;
  134. Function PRT_DriverNo: integer;
  135. Function PRT_ModeNo: integer;
  136. Function PRT_errormsg ( errorcode: integer ): string;
  137.  
  138. Function PRT_BufferNeeded ( x1, y1, x2, y2: integer ): longint;
  139. Function PRT_XMSBufferNeeded ( x1, y1, x2, y2: integer ): longint;
  140. Function PRT_Resolution ( var Xres, Yres: integer ): integer;
  141.  
  142.  
  143.  (* Procedure initializes PBGI, calls Draw(), closes PBGI,
  144.     DOES NOT print picture, and DOES NOT allocate or free the buffer *)
  145. Function PRT_BuildBitMap ( var graphdriver, graphmode: integer;
  146.                            var pathtodriver: string;
  147.                            x1,y1, x2,y2: integer;
  148.                            Draw: DrawFuncT; UserPointer: pointer ): integer;
  149.  
  150. (* Procedures which may be called before freeing the buffer *)
  151. Function PRT_GetDriverAddress ( drv: integer ): pointer;
  152.  
  153. Function PRT_InitPrt ( var handle: file ): integer;
  154. Function PRT_EndPrt ( var handle: file ): integer;
  155. Function PRT_Send( s: string ): integer;
  156. Function PRT_PrintBuffer ( var handle: file ): integer;
  157. Function PRT_getpixel ( x, y: integer ): word;
  158. Procedure setcharsize_Pix ( width,height: integer );
  159. Procedure setfillpattern16 ( upattern: pointer; color: integer );
  160. Procedure getfillpattern16 ( upattern: pointer );
  161.  
  162. Function PRT_AllocateBuffer: integer;
  163. Function PRT_FreeBuffer: integer;
  164.  
  165.  
  166. Function PRT_installuserdriver ( name: string; detectFunc: pointer ): integer;
  167. Function PRT_registerbgidriver ( driver: pointer ): integer;
  168. Function PRT_Unregisterbgidriver ( driver: pointer ): integer;
  169. Function PRT_SetViewSize( x1, y1, x2, y2: integer ): integer;
  170. Function PRT_initgraph( var graphdriver, graphmode: integer;
  171.                         pathtodriver: string ): integer;
  172.  
  173. Function PRT_closegraph: integer; { DOES NOT free the buffer   }
  174.  
  175.    Type
  176.       PRT__FilePtr = ^file;
  177.       PRT__ErrorFuncT = Function ( var handle:file): integer;
  178.       PRT__OpenFuncT  = Function ( var outname: string ): PRT__FilePtr;
  179.       PRT__CloseFuncT = Function ( var handle: file ): integer;
  180.       PRT__WriteFuncT = Function ( var handle: file; buf: pointer;
  181.                                    len: word ): integer;
  182.       PRT__ErrorFuncP = ^PRT__ErrorFuncT;
  183.       PRT__OpenFuncP  = ^PRT__OpenFuncT;
  184.       PRT__CloseFuncP = ^PRT__CloseFuncT;
  185.       PRT__WriteFuncP = ^PRT__WriteFuncT;
  186.  
  187.  Function PRT_SetErrorFunc ( WrErrFunc: PRT__ErrorFuncT ): PRT__ErrorFuncP;
  188.  Function PRT_SetOpenFunc  ( f: PRT__OpenFuncT ): PRT__OpenFuncP;
  189.  Function PRT_SetCloseFunc ( f: PRT__CloseFuncT ): PRT__CloseFuncP;
  190.  Function PRT_SetWriteFunc ( f: PRT__WriteFuncT ): PRT__WriteFuncP;
  191.  
  192. Function CloseCallerBGI: integer;
  193. Function RestoreCallerBGI ( var graphdriver, graphmode: integer;
  194.                             pathtodriver: string ): integer;
  195.  
  196.  
  197. Procedure BitImage;   { link our bit image BGI driver }
  198.  
  199.